public class DataType {
    public static void main(String[] args) {

        float a = 0.0f;//float类型变量赋值时必须加f/F

        char b = '巡';//char类型2字节，与C语言不同
        System.out.println(b);

        System.out.println(Character.MIN_VALUE);//可能为不可打印字符,最大值同理

        int c = 10;
        long d = 20;
        c = (int) d;
        System.out.println(c);//强制类型转换可能会缺失数据

        System.out.println(Byte.MAX_VALUE);//127
        byte e = (byte) 256;
        System.out.println(e);

        short f = 10;
        byte g = 20;
        int h = f + g;
        System.out.println(h);//小于4字节的类型变量，运算时会转换为4字节的int

        String i = "just";
        System.out.println(i);
        String j = "true";
        String k = i + " " + j;
        System.out.println("k:" + k);

        int l = 30;
        int m = 40;
        System.out.println(l + m + "haha");//加括号，即"haha" + (l + m)效果相同

        int n = 50;
        String o = n + "";//int转String
        double p = 60.9;
        String q = String.valueOf(p);//其他类型转String，以double举例
        System.out.println(p);

        String r = "70.8";
        double s = Double.parseDouble(r);//String转其他类型
        System.out.println(s);
    }
}
